﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;

namespace ZK.YCGLRD_WindowsService
{
    public class WarnSoundController : ApiController
    {

        /// <summary>
        /// 播放警报铃声
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public bool GetWarn(byte num)
        {
            try
            {
                // Common.SimpleLog.WriteLog("GetRun  接口被调用数据 ");
                Common.Log4.LogManage.WriteInfo("GetRun  接口被调用数据");
                string path = string.Empty;
                /*
                 1 超载
                 2 超时
                  */
                switch (num)
                {
                    case 1:
                        path = Common.AppConfigHelper.GetAppSettings("CLCZ");
                        break;
                    case 2:
                        path = Common.AppConfigHelper.GetAppSettings("CLCS");
                        break;
                    default:
                        break;
                }
                System.Media.SoundPlayer sp = new System.Media.SoundPlayer();
                sp.SoundLocation = path;
                sp.Play();
                return true;
            }
            catch (Exception ex)
            {

                Common.Log4.LogManage.WriteErr(ex.ToString());
                return false;
            }

        }
    }
}
